﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Lecturer>>" %>
<%@ Import Namespace="Resources" %>
<%@ Import Namespace="ViewRes" %>
<%
    if (Model.Count() == 0)
    {%>
<span class='mediumBoldText'>
    <%:AdministratorsStrings.NoLecturers%></span>
<%
    } %>
<%
    else
    {%>
<%
        string defaultAction = ViewData["DefaultAction"] == null ? null : ViewData["DefaultAction"].ToString();
        string confirmationString = null;

        string submitButtonValue = null;
        switch (defaultAction)
        {
            case "Delete":
                submitButtonValue = DiplomaResources.Delete;
                confirmationString = DiplomaResources.DoYouConfirmDeletion;
                break;
            case "Restore":
                submitButtonValue = DiplomaResources.Restore;
                confirmationString = DiplomaResources.DoYouConfirmRestoring;
                break;
            default:
                break;
        }
%>
<ol style="list-style: none outside none;">
    <%
        using (
            Html.BeginRouteForm("Default", new {controller = "Lecturers", action = defaultAction}, FormMethod.Post,
                                new {onSuccess = "loadActiveEntries(); "}))
        {%>
        <%
            foreach (Lecturer lecturer in Model)
            {%>
            <%
                Html.RenderPartial("~/Views/Lecturers/ViewLecturerControl.ascx", lecturer);%>
        <%
            }%>
        <hr />
        <input type="submit" value="<%:submitButtonValue%>" onclick=" return deleteEntity('<%=confirmationString%>', loadActiveEntries)" />
    <%
        }%>
</ol>

<%
    }%>